package com.sun.service.impl;

import com.sun.entity.Borrow;
import com.sun.entity.BorrowUtil;
import com.sun.mapper.BorrowMapper;
import com.sun.service.BorrowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author SunRui
 * @description TODO
 * @date 2024/8/10 22:24
 */
@Service
public class BorrowServiceImpl implements BorrowService {
    @Autowired
    private BorrowMapper borrowMapper;
    @Override
    public int addBorrow(List<Borrow> borrow) {
        return borrowMapper.addBorrow(borrow);
    }

    @Override
    public List<Borrow> getBorrow(int readerId, int back) {
        return borrowMapper.getBorrow(readerId,back);
    }

    @Override
    public int updateBack(int id) {
        return borrowMapper.updateBack(id);
    }

    @Override
    public int updateRenewDays(int renewDays, int id) {
        return borrowMapper.updateRenewDays(renewDays,id);
    }

    @Override
    public Borrow getBorrowById(int borrowId) {
        return borrowMapper.getBorrowById(borrowId);
    }

    @Override
    public List<BorrowUtil> getBorrowUtilList(int readerId, int page) {
        return borrowMapper.getBorrowUtilList(readerId,page);
    }

    @Override
    public int getAllPage(int readerId) {
        return borrowMapper.getAllPage(readerId);
    }
}
